package teacherstudent;

import static org.junit.jupiter.api.Assertions.*;

import java.util.List;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class StudentDaoImplTest {
	StudentDaoImpl sdi = new StudentDaoImpl();
	
	@BeforeEach
	void testInsert() {
		sdi.insert(new Student(1,"zs",'男',89));
		sdi.insert(new Student(2,"li",'女',59));
		sdi.insert(new Student(3,"wan",'男',69));
		sdi.insert(new Student(4,"mal",'女',77));
		sdi.insert(new Student(5,"zhq",'男',46));
		sdi.insert(new Student(5,"xiam",'女',99));
	}

	@Test
	void testUpdate() {
		sdi.update(new Student(4,"ll",'女',78));
	}

	@Test
	void testDelete() {
		sdi.delete(4);
	}

	@Test
	void testSelectById() {
		Student s = sdi.selectById(4);
		System.out.println(s);
	}

	@AfterEach
	void testSelectAll() {
		List<Student> all = sdi.selectAll();
		all.forEach(System.out::println);
	}

	@Test
	void testSortByScoreDesc() {
		List<Student> sorts = sdi.sortByScoreDesc();
		sorts.forEach(System.out::println);
	}

}
